package Server.entity;

import lombok.Data;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.math.BigDecimal;

/**
 * Entity - 订单项
 *
 * @author xvzhe
 * @version 0.1
 *
 */
@Data
@Entity
@EntityListeners(AuditingEntityListener.class)
@DynamicInsert
@DynamicUpdate
public class ShopOrderItem {
    @Id
    @GeneratedValue(generator = "UuidProduce")
    @GenericGenerator(name="UuidProduce", strategy="Server.tool.UuidProduce")
    private String uuid;

    /*
     *
     * 商品
     *
     * */
    @ManyToOne
    @JoinColumn(name = "specId")
    private  ShopSpec shopSpec;

    /*
    *
    * 主订单
    *
    * */
    @ManyToOne
    @JoinColumn(name = "orderId")
    private  ShopOrder shopOrder;

    /*
    * 个数
    *
    * */
    @Column
    private Integer count;

    /*
    *
    * 金额
    *
    * */
    @Column
    private BigDecimal money;


    public String getUuid() {
        return uuid;
    }

    public void setUuid(String uuid) {
        this.uuid = uuid;
    }

    public ShopSpec getShopSpec() {
        return shopSpec;
    }

    public void setShopSpec(ShopSpec shopSpec) {
        this.shopSpec = shopSpec;
    }

    public ShopOrder getShopOrder() {
        return shopOrder;
    }

    public void setShopOrder(ShopOrder shopOrder) {
        this.shopOrder = shopOrder;
    }

    public Integer getCount() {
        return count;
    }

    public void setCount(Integer count) {
        this.count = count;
    }

    public BigDecimal getMoney() {
        return money;
    }

    public void setMoney(BigDecimal money) {
        this.money = money;
    }
}
